import { defineStore } from 'pinia'

/**
 *
 */
export const useAuthStore = defineStore('auth', () => {
  const token = ref<string>('')

  const hasLogin = computed(() => token.value !== '')

  const setToken = (newToken: string) => {
    token.value = newToken
  }

  const resetToken = () => {
    token.value = ''
  }
  return {
    token,
    setToken,
    resetToken,
    hasLogin,
  }
}, {
  persist: true,
})
